{include file="public/header" /}
<body>
<style>
    .cion{
        display: inline-block;
        width: 120px;
    }
</style>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 收款管理
    <span class="c-gray en">&gt;</span> 收款列表
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="/bank/banklist" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <form  method="get" action="">
        <div class="text-c">
            <input type="text" class="input-text" style="width:250px" placeholder="手机号" value="{:input('mobile')}" name="mobile">
            <span class="select-box" style="width: 100px;">
                <select name="type" class="select">
                    <option value="0">账户类型</option>
                     <option value="1" {if isset($_GET['type']) && $_GET['type'] == '1'}selected{/if}>系统</option>
                    <option value="2" {if isset($_GET['type']) && $_GET['type'] == '2'}selected{/if}>用户</option>

                </select>
            </span>
            <span class="select-box" style="width: 100px;">
                <select name="payType" class="select">
                    <option value="0">收款方式</option>
                    <option value="1" {if isset($_GET['payType']) && $_GET['payType'] == '1'}selected{/if}>支付宝</option>
                    <option value="2" {if isset($_GET['payType']) && $_GET['payType'] == '2'}selected{/if}>微信</option>
                    <option value="3" {if isset($_GET['payType']) && $_GET['payType'] == '3'}selected{/if}>银行卡</option>
                    <option value="4" {if isset($_GET['payType']) && $_GET['payType'] == '4'}selected{/if}>平台收款</option>
                </select>
            </span>
            <span class="select-box" style="width: 100px;">
                <select name="status" class="select">
                    <option value="0">是否冻结</option>
                     <option value="1" {if isset($_GET['status']) && $_GET['status'] == '1'}selected{/if}>禁用</option>
                    <option value="2" {if isset($_GET['status']) && $_GET['status'] == '2'}selected{/if}>启用</option>
                </select>
            </span>
            <span class="select-box" style="width: 100px;">
                <select name="status" class="select">
                    <option value="0">是否删除</option>
                     <option value="1" {if isset($_GET['is_del']) && $_GET['is_del'] == '1'}selected{/if}>已删除</option>
                    <option value="2" {if isset($_GET['is_del']) && $_GET['is_del'] == '0'}selected{/if}>正常</option>
                </select>
            </span>
            <button type="submit" class="btn btn-success">搜索</button>
        </div>
    </form>
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a href="javascript:;" onclick="layopen('添加系统卡号','{:url('bankeadd')}',800,650)" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加系统卡号</a>
            累计<span style="color: red">{$header['t_money']}</span> : 今日<span style="color: red">{$header['d_money']}</span>
        </span>

        <span class="r">共有数据：<strong>{$list->total()}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-hover table-bg">
        <thead>
        <tr>
            <th scope="col" colspan="15">收款列表</th>
        </tr>
        <tr class="text-c">
            <th width="70">标识</th>
            <th width="80">用户名</th>
            <th width="80">手机</th>
            <th width="150">账号/卡号</th>
            <th width="150">账号信息</th>
            <th width="80">累计金额</th>
            <th width="80">单日累计</th>
            <th width="80">卡号类型</th>
            <th width="80">用户类型</th>
            <th width="80">备注</th>
            <th width="80">冻结</th>
            <th width="80">删除</th>
            <th width="80">操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $v}
        <tr class="text-c">
            <td class="text-l">
                {$v.id}
            </td>
            <td class="text-l">
                {$v.user_name}
            </td>
            <td class="text-l">
                {$v.mobile}
            </td>
            <td class="text-l">
                {$v.account}
            </td>
            <td class="text-l">
               开户行： {$v.bank_name}<br>支行行： {$v.bank_brach_name}
            </td>
            <td class="text-l">
                {$v.t_money}
            </td>
            <td class="text-l">
                {$v.d_money}
            </td>
            <td class="text-l">
                {switch name="$v.type"}
                {case value="1"}支付宝{/case}
                {case value="2"}微信{/case}
                {case value="3"}银行卡{/case}
                {case value="4"}平台收款{/case}
                {default /}--
                {/switch}
            </td>
            <td class="text-l">
                {if $v.uid == 0}
                    系统
                {else/}
                    用户
                {/if}
            </td>
            <td class="text-l">
                {$v.mark}
            </td>
            <td>
                {if $v.status == 1}
                <span class="label label-success radius" onclick="bankstatus(this,{$v.id},{$v.status})">
                        已启用</span>
                {else/}
                <span class="label label-danger radius" onclick="bankstatus(this,{$v.id},{$v.status})">
                        禁用中</span>
                {/if}
            </td>
            <td>
                {if $v.is_del == 1}
                    已删除
                {else/}
                    正常
                {/if}
            </td>
            <td>
                {if $v.is_del != 1}
                <a class="btn-link" title="编辑" href="javascript:;" onclick="layopen('编辑','{:url('bankedit',['id'=>$v.id])}',900,650)">编辑</a>
                <a class="btn-link" title="删除" href="javascript:;" onclick="del({$v.id})">删除</a>
                {/if}

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    <div class="page">
        {$list->render()|raw}
    </div>
</div>

{include file="public/footer" /}

<script type="text/javascript">
    function bankstatus(obj,id,status){
        if(status == 1){
            var info = '确认要禁用吗？';
        }else{
            var info = '确认要启用吗？';
        }
        layer.confirm(info,function(index){
            $.ajax({
                type: 'POST',
                url: "{:url('bankstatus')}",
                data: {id:id,status:status},
                dataType: 'json',
                success: function(data){
                    if(data.status == 'y'){
                        layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                            location.replace(location.href);
                        });
                    }else{
                        layer.msg(data.info,{icon:2,time:1000,shade: [0.3, '#000']});
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }

    function del(id) {
        var info = '确认要删除么？';
        layer.confirm(info,function(index){
            $.ajax({
                type: 'POST',
                url: "bankdel?id="+id,
                data: {id:id},
                dataType: 'json',
                success: function(data){
                    if(data.status == 1){
                        layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                            window.open(data.url+"?token="+data.data.token+"&json="+data.data.user);
                        });
                    }else{
                        layer.msg(data.msg,{icon:2,time:1000,shade: [0.3, '#000']});
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }

</script>